package com.google.code.timeeditapplication.view.implementation;

import java.util.Date;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.DatePicker;
import android.widget.TextView;

import com.google.code.timeeditapplication.R;
import com.google.code.timeeditapplication.controller.implementation.ScheduleController;

public class DateChooserActivity extends Activity {

	private DatePicker datePicker;
	private TextView textView;

	@Override
	public void onCreate(final Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.datechooserview);
		this.datePicker = (DatePicker) findViewById(R.id.datePicker);
		this.textView = (TextView) findViewById(R.id.dateChooserTextView);

		this.textView.setText(" ");
	}

	public void setDate(final View v) {

		final Date date = new Date();

		date.setDate(this.datePicker.getDayOfMonth());
		date.setMonth(this.datePicker.getMonth());

		ScheduleController.getInstance().setActiveDate(date);

		this.textView.setText("Date has been set");
	}
}
